package cn.xjt.springcloud;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;

/**
 * 内容：
 *
 * @author
 * @date 2021/2/27-17:02
 */

@SpringBootApplication
@EnableEurekaClient
@EnableDiscoveryClient			//服务发现
public class SpringCloud_Dept_8001Application {
	public static void main(String[] args) {
		SpringApplication.run(SpringCloud_Dept_8001Application.class,args);
	}

//	@Bean				//增加一个servlet，配合监控页面使用，固定写死的
//	public ServletRegistrationBean hystrixMetricsStreamServlet(){
//		ServletRegistrationBean re = new ServletRegistrationBean(new HystrixMetricsStreamServlet());
//		re.addUrlMappings("/actuator/hystrix.stream");
//		return re;
//	}

//	@Bean		//增加一个servlet，配合监控页面使用，固定写死的
//	public ServletRegistrationBean getServlet() {
//		HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
//		ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
//		registrationBean.setLoadOnStartup(1);
//		registrationBean.addUrlMappings("/actuator/hystrix.stream");
//		registrationBean.setName("HystrixMetricsStreamServlet");
//		return registrationBean;
//	}
}
